package com.cyzy.controller;

import com.cyzy.domain.TGoods;
import com.cyzy.service.impl.TGoodsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/tgoods")
public class TGoodsController {

    @Autowired
    private TGoodsServiceImpl tgoodsService;

    @PostMapping("/insertGoods")
    public int insertGoods(@RequestBody List<TGoods> listgoods) {
        tgoodsService.insertGoods(listgoods);
        return listgoods.size();
    }
    @PostMapping("/updateState")
    public int updateState(@RequestBody List<TGoods> listgoods) {
        tgoodsService.updateState(listgoods);
        return listgoods.size();
    }
    @PostMapping("/updateGoods")
    public int updateGoods(@RequestBody TGoods goods) {
     int data= tgoodsService.updateGoods(goods);
      return data;
    }
}
